﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using System.Data;
using System.ComponentModel;

namespace CRMSystemV2.Service
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“ICRMSystemAPI”。
    [ServiceContract]
    public interface ICRMSystemAPI
    {
        [OperationContract]
        [WebInvoke(
            //Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/Login?username={username}&password={password}")]
        //[WebGet(UriTemplate = "Login/{username}&{password}")]
        string Login(string username, string password);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="username"></param>
        /// <param name="oldPassword"></param>
        /// <param name="newPassword"></param>
        /// <returns></returns>
        [OperationContract]
        string ChangePassword(string username, string oldPassword, string newPassword);
        /// <summary>
        /// 分页获取用户列表
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="rowTotal"></param>
        /// <param name="pageTotal"></param>
        /// <param name="keyWords"></param>
        /// <param name="orderField"></param>
        /// <param name="orderDirection"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable UserPageView(out int rowTotal, out int pageTotal, int pageSize, int pageIndex, Dictionary<string, string> keyWords, string orderField, string orderDirection);
        /// <summary>
        /// 用户导出
        /// </summary>
        /// <param name="maxTotal"></param>
        /// <param name="keyWords"></param>
        /// <param name="orderField"></param>
        /// <param name="orderDirection"></param>
        /// <returns></returns>
        [OperationContract]
        DataTable UserExportTable(int maxTotal, Dictionary<string, string> keyWords, string orderField, string orderDirection);
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="username"></param>
        /// <param name="jobno"></param>
        /// <param name="email"></param>
        /// <param name="phone"></param>
        /// <param name="isenable"></param>
        /// <returns></returns>
        [OperationContract]
        string UserInsert(string username, string jobno, string email, string phone, int isenable);
        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [OperationContract]
        Model.User GetUser(string id);
        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="id"></param>
        /// <param name="username"></param>
        /// <param name="jobno"></param>
        /// <param name="email"></param>
        /// <param name="phone"></param>
        /// <param name="isenable"></param>
        /// <returns></returns>
        [OperationContract]
        string UserUpdate(int id, string username, string jobno, string email, string phone, int isenable);
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [OperationContract]
        string ResetPassword(string id);
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [OperationContract]
        string UserDelete(string ids);
        
    }
}
